package com.ypx;


import java.util.LinkedList;

public class LinkedListDemo {

    public static void main(String[] args) {
        LinkedList<String> list = new LinkedList<>();

        list.addFirst("apple");
        list.addLast("banana");
        list.addLast("orange");
        list.addLast("grape");



        System.out.println(list);

        list.remove(1);
        System.out.println(list);

        String first = list.get(1);
        System.out.println(first);

        list.set(1, "pear");
        System.out.println(list);



    }
}
